/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package kimo.bl;

import java.util.Map;
import kimo.persistence.entities.User;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.Initiator;
import org.zkoss.zul.Messagebox;

/**
 *
 * @author a381u296
 */
public class AuthenticationInit implements Initiator {

    @Override
    public void doInit(Page page, Map<String, Object> args) throws Exception {

        Session session = Sessions.getCurrent();
        User user = (User) session.getAttribute("user");

        if (user == null) {
            Executions.sendRedirect("/index.zul");
        } else {
          // Messagebox.show("σε ξερω εσένα, εισαι ο : " + user.getUserFirstName());
        }

    }
}
